<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@page import="java.sql.*" %>
<%@page import="com.DBUtils.DBUtil"%>
<%@page import="javax.servlet.http.HttpSession"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

		<title>天涯论坛_全球华人网上家园_天涯论坛</title>
		<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css"/>
		<script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
		<script src="js/bootstrap.min.js" type="text/javascript" charset="utf-8"></script>
		<link rel="stylesheet" type="text/css" href="css/TY.css"/>
		<link rel="stylesheet" type="text/css" href="css/bbs_first.css"/>
		<style type="text/css">
			html{
				color: #000000;
			}
			body{
				font-family: arial,宋体;
				font-size: 12px;
			}
		</style>
	</head>
	<body>
		<div id="top_nav_banner">
			<div id="top_nav_wrap">
				<div id="top_nav">
					<div class="top-nav-logo">
						<a _tystat="新版顶导航/Logo" href="http://focus.tianya.cn/"></a>
					</div>
					<div class="top-nav-main">
						<div class="top-nav-menu clearfix">
							<div class="top-nav-f1">
								<ul class="top-nav-menu-list clearfix">
									<li class="top-nav-menu-li top-nav-menu-li-first">
										<a class="top-nav-main-menu on" _tystat="新版顶导航/论坛" href="http://bbs.tianya.cn/">论坛</a>
									</li>
									<li class="top-nav-menu-li">
										<a class="top-nav-main-menu" _tystat="新版顶导航/分社区/聚焦" href="http://focus.tianya.cn/">聚焦</a>
									</li>
									<li class="top-nav-menu-li">
										<a class="top-nav-main-menu" _tystat="新版顶导航/部落" href="http://groups/tianya.cn/">部落</a>
									</li>
									<li class="top-nav-menu-li">
										<a class="top-nav-main-menu" _tystat="新版顶导航/天涯榜" href="http://shang.tianya.cn/">天涯榜</a>
									</li>
									<li class="top-nav-menu-li"></li>
								</ul>
							</div>
							<div id="top_search" class="top-nav-search" style="overflow: hidden;">
								
							</div>
							<div id="top_user_menu" class="top_nav_fr">
								<!--<ul id="top-nav" class="top-nav-menu-li top-nav-menu-li-first">
									<li class="top-nav-menu-li top-nav-menu-li-first">
										<a id="js_login" class="top-nav-user-menu" href="signIn.jsp" rel="nofollow" _tystat="新版顶导航/登录">登录</a>
									
									</li>
									<li class="top-nav-menu-li">
										<a class="top-nav-user-menu"href="register.jsp" target="_blank" rel="nofollow" _tystat="新版顶导航/注册">注册</a>
									</li>
								</ul>-->
								<%
									if(session.getAttribute("name")==null){
										out.println("<ul id='top-nav' class='top-nav-menu-li top-nav-menu-li-first'>"
										+"<li class='top-nav-menu-li top-nav-menu-li-first'><a id='js_login' class='top-nav-user-menu' href='signIn.jsp' rel='nofollow' _tystat='新版顶导航/登录'>登录</a></li>"
										+"<li class='top-nav-menu-li'><a class='top-nav-user-menu' href='register.jsp' target='_blank' rel='nofollow' _tystat='新版顶导航/注册'>注册</a></li>"
										+"</ul>");
									}else{
										out.println("<ul id='top-nav' class='top-nav-menu-li top-nav-menu-li-first'>"
													+"<li class='top-nav-menu-li top-nav-menu-li-first'>欢迎您：<a id='js_login' class='top-nav-user-menu' href='signIn.jsp' rel='nofollow'>"+session.getAttribute("name")+"</a></li>"
													+"</ul>");
									}
								%>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
		<div id="bbsdoc">
			<div id="bd" class="layout-lmr clearfix">
				<div id="left">
					<div id="bbs_left_nav" class="bbs_left_nav">
						<div class="list-group text-center">
							<a class="list-group-item active" href="">了解天涯</a>
							<div class="line"></div>
							<a class="list-group-item active" href="">区域论坛</a>
							<div class="line"></div>
							<a class="list-group-item active" href="">职业交流</a>
						</div>
					</div>
				</div>
				<div id="main_right">
					
				</div>
				<div id="right">
					<div class="section">
						<div class="hd clearfix">
							<h2>社区公告</h2>
						</div>
						<div class="bd">
							<ul class="text-list">
								<li>
									<a class="title" href="" title="带你领略世界初春短视频征集">带你领略世界初春短视频征集</a>
								</li>
								<li>
									<a class="title" href="" title="守护上线啦！快来成为守护神！">守护上线啦！快来成为守护神！</a>
								</li>
								<li>
									<a class="title" href="" title="打赏触屏版优化，教你新玩法！">打赏触屏版优化，教你新玩法！</a>
								</li>
								<li class="more">
									<a href="">更多>></a>
								</li>
							</ul>
						</div>
					</div>
					<div id="AD_img" class="section">
						
					</div>
				</div>
				<div id="main">
					<div class="wrap-1 clearfix js-bbs-hot-list">
						<div class="tag-list clearfix">
							<ul class="clearfix">
								<li class="curr">
									<span>帖子专区</span>
								</li>
							</ul>
							<div id="myTopBlock">
								
							</div>
						</div>
						<div class="wrap-hd clearfix">
							<div class="wrap-hd-1"></div>
							<div class="wrap-hd-2"></div>
						</div>
						<div class="wrap-bd clearfix">
							<div class="wrap-bd-in">
								<div id="postContent" class="table-responsive">
									<% 
//										String sql="select title,FK_a from bbstopic";
//										Connection con=DBUtil.getconn();
//										Statement stm=con.createStatement();
//										ResultSet rs=stm.executeQuery(sql);
//										out.print("<table>");
//										while(rs.next()){
//											out.print("<tr><td>"+rs.getString("title")+"</td><td>"+rs.getString("FK_a")+"</td>");
//										}
//										out.print("</table>");
//									%>
								</div>
								
								<div style="position: absolute;bottom: 0;" class="page">
									<nav aria-label="Page navigation">
	  									<ul class="pagination">
	   										<li>
	    									 	<button class="btn btn-primary" aria-label="Previous">
	       										 	<span aria-hidden="true">&laquo;</span>
	     									 	</button>
	   										</li>
										    <li><button class="btn btn-primary">1</button></li>
										    <li><button class="btn btn-primary">2</button></li>
										    <li><button class="btn btn-primary">3</button></li>
										    <li><button class="btn btn-primary">4</button></li>
										    <li><button class="btn btn-primary">5</button></li>
										    <li>
										      <button class="btn btn-primary" aria-label="Next">
										        <span aria-hidden="true">&raquo;</span>
										      </button>
										    </li>
										  </ul>
										</nav>
								</div>
							</div>
						</div>
						<div class="wrap-ft">
							
						</div>
					</div>
					<div class="wrap-1 clearfix js-bbs-hot-list">
						
					</div>
					<div class="wrap-1 clearfix js-bbs-hot-list">
						
					</div>
				</div>
			</div>
		</div>
		<div class="foot">
			<div class="btn">
				<a class="btn btn-primary" href="post.jsp">我要发帖</a>
			</div>
		</div>
		<script type="text/javascript">
			$(document).ready(function(){
				$.ajax({
					type:"post",
					url:"HomePageServlet",
					async:true,
					success:function(data){
						var jsonObj=jQuery.parseJSON(data);//获取jSON里面的内容
						html="<table style='width:100%'>";
						$.each(jsonObj, function(i,obj) {//遍历
							html+="<tr id='"+obj.id+"'><td style='float:left'>"+"<a href='ContentServlet?id="+obj.id+"'>"+obj.title+"</a></td>";
							html+="<td style='float:right'><a href='UserInformationServlet?name="+obj.nickName+"'>"+obj.nickName+"</td></tr>";
						});
						html+="</table>";
//						alert(html);
						$("#postContent").append(html);
					}
				});
			})
			$(document).ready(function(){
				$(".pagination li").click(function(){
					var _this_=this;
					var curPage=$(_this_).text();
					$("#postContent").html("");
					$.ajax({
						type:"post",
						url:"PageServlet",
						async:true,
						data:{"page":curPage},
						success:function(data){
							var jsonObj=jQuery.parseJSON(data);//获取jSON里面的内容
							html="<table style='width:100%'>";
							$.each(jsonObj, function(i,obj) {//遍历
								html+="<tr id='"+obj.id+"'><td style='float:left'>"+"<a href='ContentServlet?id="+obj.id+"'>"+obj.title+"</a></td>";
								html+="<td style='float:right'><a href='UserInformationServlet?name="+obj.nickName+"'>"+obj.nickName+"</td></tr>";
							});
							html+="</table>";
	//						alert(html);
							$("#postContent").append(html);
						}
					});
				})
			})
	</script>
	</body>
</html>